//
//  NLAdaptiveFont.m
//  IntelligentLock
//
//  Created by yj_zhang on 2019/5/27.
//  Copyright © 2019 yj_zhang. All rights reserved.
//

#import "NLAdaptiveFont.h"
#import "DSSetingConfigure.h"

@implementation NLAdaptiveFont

+ (BOOL)isRetina{
    if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0 || [UIScreen mainScreen].scale == 3.0))
        return YES;
    else
        return NO;
}

+ (BOOL)isRetinaHD{
    if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 3.0))
        return YES;
    else
        return NO;
}

- (CGSize)fixedScreenSize{
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    
    if((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation))
    {
        return CGSizeMake(screenSize.height, screenSize.width);
    }
    
    return screenSize;
}

/** 字体大小  可以根据UI需要修改*/
+ (float)numberFontSize:(float)number
{
    return ((number * IMSCREEN_WIDTH) / 750.f);
}

//宽度自适应
+ (float)numberFromWidth750:(float)number
{
    return number * IMSCREEN_WIDTH / 750.0f;
}
+ (float)numberFromWidth375:(float)number
{
    return number * IMSCREEN_WIDTH / 375.0f;
}
//高度自适应
+ (float)numberFromHeight1334:(float)number{
    return number * IMSCREEN_HEIGHT / 1334.0f;
}
+ (float)numberFromHeight667:(float)number{
    return number * IMSCREEN_HEIGHT / 667.0f;
}

+(float)numberImgScaleH:(float)number{
    return number * IMSCREEN_HEIGHT / 1334.0f;
}
+(float)numberImgScaleW:(float)number{
    return number * IMSCREEN_WIDTH / 750.0f;
}

@end
